FROM {{ namespace }}/{{ infra_image_prefix }}prometheus-base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}

{% block prometheus_ovn_exporter_header %}{% endblock %}

{% block prometheus_ovn_exporter_repository_version %}

{% if base_arch == 'x86_64' %}
ARG ovn_arch=amd64
{% elif base_arch == 'aarch64' %}
ARG ovn_arch=arm64
{% endif %}

ARG prometheus_ovn_version=1.0.6
ARG prometheus_ovn_cksum_url=https://github.com/greenpau/ovn_exporter/releases/download/v${prometheus_ovn_version}/checksums.txt
ARG ovn_exporter_tgz=ovn-exporter_${prometheus_ovn_version}_linux_${ovn_arch}.tar.gz
ARG prometheus_ovn_url=https://github.com/greenpau/ovn_exporter/releases/download/v${prometheus_ovn_version}/${ovn_exporter_tgz}
{% endblock %}

{% block prometheus_ovn_exporter_install %}

RUN curl -Lo /tmp/${ovn_exporter_tgz} ${prometheus_ovn_url} \
    && curl -Lo /tmp/checksums.txt ${prometheus_ovn_cksum_url} \
    && cd /tmp \
    && sha256sum --ignore-missing -c /tmp/checksums.txt \
    && tar xvf /tmp/${ovn_exporter_tgz} -C /opt/ \
    && rm -f /tmp/${ovn_exporter_tgz} \
    && rm -f /tmp/checksums.txt
{% endblock %}

{% block prometheus_ovn_exporter_footer %}{% endblock %}
{% block footer %}{% endblock %}

USER prometheus
